/** @format */

import { Select, SelectProps } from "antd";

interface TagListProps {
  value?: string;
  onChange?: (value: string) => void;
  dataSource: SelectProps["options"];
}

const WeekChooseOfDay: React.FC<TagListProps> = (props) => {
  const { value, onChange, dataSource } = props;

  const onChangeHandler = (el: any | string[]) => {
    onChange?.((el as string[]).join(","));
  };

  return (
    <Select
      mode="multiple"
      allowClear
      style={{ width: "280px" }}
      placeholder="请选择"
      defaultValue={() => value?.split(",")}
      onChange={onChangeHandler}
      options={dataSource}
    ></Select>
  );
};

export default WeekChooseOfDay;
